<?php
class MFile{
    public function read($file, $attr="r", $throw=true){
        if(file_exists($file) && is_readable($file)){
            $hand       = fopen($file, $attr);
            $contents  = fread($hand, filesize($file));
            fclose($hand);
            return $contents;
        }

        if(true == $throw)
            throw new MException("文件不存在或者不可读.");

        return false;
    }
}
?>
